/**
 * Copyright (c) 2013-Now http://jeesite.com All rights reserved.
 * No deletion without permission, or be held responsible to law.
 * @author FIRE
 */
import { defHttp } from '/@/utils/http/axios';
import { useGlobSetting } from '/@/hooks/setting';
import { TreeDataModel, TreeModel } from '../model/baseModel';

const { adminPath } = useGlobSetting();

export interface ShopExtendCls extends TreeModel<ShopExtendCls> {
  code?: string; // 系列编码
  name?: string; // 系列名称
  bappShow?: string; // 是否APP显示
  picUrl?: string; // APP图片路径
  fileId?: string; // APP文件ID
}

export const shopExtendClsList = (params?: ShopExtendCls | any) =>
  defHttp.get<ShopExtendCls>({ url: adminPath + '/shop/product/shopExtendCls/list', params });

export const shopExtendClsListData = (params?: ShopExtendCls | any) =>
  defHttp.post<ShopExtendCls[]>({
    url: adminPath + '/shop/product/shopExtendCls/listData',
    params,
  });

export const shopExtendClsForm = (params?: ShopExtendCls | any) =>
  defHttp.get<ShopExtendCls>({ url: adminPath + '/shop/product/shopExtendCls/form', params });

export const shopExtendClsCreateNextNode = (params?: ShopExtendCls | any) =>
  defHttp.get<ShopExtendCls>({
    url: adminPath + '/shop/product/shopExtendCls/createNextNode',
    params,
  });

export const shopExtendClsSave = (params?: any, data?: ShopExtendCls | any) =>
  defHttp.postJson<ShopExtendCls>({
    url: adminPath + '/shop/product/shopExtendCls/save',
    params,
    data,
  });

export const shopExtendClsDisable = (params?: ShopExtendCls | any) =>
  defHttp.get<ShopExtendCls>({ url: adminPath + '/shop/product/shopExtendCls/disable', params });

export const shopExtendClsEnable = (params?: ShopExtendCls | any) =>
  defHttp.get<ShopExtendCls>({ url: adminPath + '/shop/product/shopExtendCls/enable', params });

export const shopExtendClsDelete = (params?: ShopExtendCls | any) =>
  defHttp.get<ShopExtendCls>({ url: adminPath + '/shop/product/shopExtendCls/delete', params });

export const shopExtendClsTreeData = (params?: any) =>
  defHttp.get<TreeDataModel[]>({
    url: adminPath + '/shop/product/shopExtendCls/treeData',
    params,
  });

export const batchPublishToApp = (params?: any, data?: ShopExtendCls | any) =>
  defHttp.postJson<ShopExtendCls>({
    url: adminPath + '/shop/product/shopExtendCls/batchPublishToApp',
    params,
    data,
  });

export const unPublishedToApp = (params?: any, data?: ShopExtendCls | any) =>
  defHttp.postJson<ShopExtendCls>({
    url: adminPath + '/shop/product/shopExtendCls/unPublishedToApp',
    params,
    data,
  });
